#pragma once
typedef struct
{
    unsigned long user_time;
    unsigned long nice_time;
    unsigned long system_time;
    unsigned long idle_time;
    unsigned long iowait_time;
    unsigned long irq_time;
    unsigned long softirq_time;
    unsigned long steal_time;
    unsigned long guest_time;
    unsigned long guest_nice_time;
    double timestamp;
    // 计算值
    double used_time;
    double total_time;
    double usage;
} cpuTime_t;

typedef struct
{
    cpuTime_t cpu_all;
    unsigned long cpu_num;
    unsigned long read_count;
    cpuTime_t *cpus;
} sys_cpuTime_t;

sys_cpuTime_t * init_sys_cpuTime();
void free_sys_cpuTime(sys_cpuTime_t * cpuTime);
sys_cpuTime_t* get_sys_cpuTime(sys_cpuTime_t* sys_cpuTime_ptr);
int cal_cpu_usage(sys_cpuTime_t * sys_cpuTime_prve, sys_cpuTime_t * sys_cpuTime_now);
void show_cpu_usage(sys_cpuTime_t* sys_cpuTime_now);
